package com.gpoint.rdp.web.controller;

import java.util.HashMap;
import java.util.Map;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("platform")
public class HomeController {
	
	
    @RequestMapping(value = "", method = RequestMethod.GET)
    public String index() {
   
        return "index/index";
    }
    @RequestMapping(value = "/first", method = RequestMethod.GET)
	public String first() {
		
		System.out.println(111);
		return "index/first";
	}
    
    
    @RequestMapping(value = "/logout", method = RequestMethod.POST)
    @ResponseBody
    public Map<String,Object> login() {
    	
		Map<String,Object> result=new HashMap<String,Object>(256);
		result.put("result", 2);
        // 从SecurityUtils里边创建一个 subject
        Subject subject = SecurityUtils.getSubject();
       
        // 执行认证登陆
        try {
            subject.logout();
    		result.put("result", 1);
    		result.put("url", "/login");
        } catch (Exception uae) {
        }

        return result;
    }

}
